package com.klun.hdfs.hd.pojo;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class UserCollectBrand implements Comparable<UserCollectBrand>, Writable {
    private Long id;
    private Long userId;
    private Long brandId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getBrandId() {
        return brandId;
    }

    public void setBrandId(Long brandId) {
        this.brandId = brandId;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeLong(id);
        dataOutput.writeLong(userId);
        dataOutput.writeLong(brandId);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        id = dataInput.readLong();
        userId = dataInput.readLong();
        brandId = dataInput.readLong();
    }

    @Override
    public String toString() {
        return id + "\t" + userId + "\t" + brandId;
    }

    @Override
    public int compareTo(UserCollectBrand o) {
        return this.id>o.getId()?-1:1;
    }
}